package com.offcn.project.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class AppSwggerConfig {

    //创建Docker对象
    @Bean
    public Docket createDocket(){
      return   new Docket(DocumentationType.SWAGGER_2).apiInfo(getApiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.offcn.project.controller")).paths(PathSelectors.any()).build();
    }

    //创建文档属性
    public ApiInfo getApiInfo(){
      return new ApiInfoBuilder().title("七易众筹-项目模块--平台接口文档").description("针对项目模块相关接口来进行定义").termsOfServiceUrl("http://www.ujiuye.com/").version("1.0").build();
    }
}
